package com.qf.openapi.web.master.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;

/**
 * 该vo类用于定义通用的，返回json字段*/

public class ResultVo extends HashMap {
    //该方法用于返回通用成功的json
    public static ResultVo ok(){
        ResultVo resultVo = new ResultVo();
        resultVo.put("code",1);
        resultVo.put("msg","ok");
        return resultVo;
    }

    /**
     * 返回错误的json
     * code   -1
     * msg   error
     */
    public static ResultVo error(){
        ResultVo resultVo = new ResultVo();
        resultVo.put("code",-1);
        resultVo.put("msg","error");
        return resultVo;
    }


    public static ResultVo error(String msg){
        ResultVo resultVo = new ResultVo();
        resultVo.put("code",-1);
        resultVo.put("msg",msg);
        return resultVo;
    }


}
